{include file="common/head"/}
<style>
    .layui-table-cell{height: auto;}
    .layui-table-cell ul li a{color: #1C8FEF;display: block;border: 1px solid #ececec;padding: 3px 8px;}
    .layui-table-cell ul li a:hover{color: #005580}
    element.style {
        /* margin-top: 50px; */
        float: left;
    }
</style>
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>个人绩效列表</legend>
    </fieldset>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show" style="float: left">
            <form class="layui-form" action="">
                <div style="float:left;">
                    <div class="layui-form-item" style="    margin-left: -119px;margin-top: 1px;">
                        <div class="layui-input-block" style="width: 210px;">
                            <select  class="form-control input-sm" name="status" lay-filter="status" aria-invalid="false" id="status1">
                                <option value="0" disabled selected style="display:none">展示考核项分类(默认全部)</option>
                                {volist name="cate_data" id="vo"}
                                <option value="{$vo.cate_id}">{$vo.title}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                </div>

                <div style="float:left;margin-left:-50px">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="width: 500px;">
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="time" placeholder="开始时间">
                                    <input type="text" class="layui-input" id="time1" placeholder="结束时间" style="margin-left: 196px;margin-top: -37px;">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div style="float:left;">
                    <div class="layui-form-item" style="    margin-left: -216px;margin-top: 1px;">
                        <div class="layui-input-block" style="width: 210px;">
                            <select  class="form-control input-sm" name="section" lay-filter="status" aria-invalid="false" id="section">
                                <option value="0" disabled selected style="display:none">请选择部门(默认全部)</option>
                                {volist name="section_data" id="vo"}
                                <option value="{$vo.section_id}">{$vo.title}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                </div>
                <div style="float:left;">
                    <div class="layui-form-item" style="    margin-left: -103px;margin-top: -2px;">
                        <div class="layui-input-block" style="width: 500px;">
                            <div class="layui-inline" >
                                <div class="layui-input-inline" style="width: 200px;">
                                    <input type="text" id="keyword" name="keyword" autocomplete="off" placeholder="请输入教师姓名/教师编号" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline" style="margin-right: 6px;">
                                <div class="layui-btn-group layui-inline">
                                    <a  href="{:url('personList')}" class="layui-btn layui-btn-primary">重置</a>
                                    <button id="search" class="layui-btn layui-btn-normal" type="button" lay-submit lay-filter="formDemo" style="background-color: #009688;">
                                        <i class="layui-icon">&#xe615;</i>查找
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>

            </form>
        </div>
    </div>
    <div  style="float: left">
        <table lay-filter="demo">
            <thead>
            <tr>
                <th lay-data="{field:'teacher_no', width:150,sort:true}">教师工号</th>
                <th lay-data="{field:'teacher_name', width:150}">教师姓名</th>
                <th lay-data="{field:'section_name', width:150}">部门名称</th>
                {volist name="cate_data" id="item"}
                <th lay-data="{field:'title{$item.cate_id}', width:150}">{$item.title}</th>
                {/volist}
                <th lay-data="{field:'total_score', width:150}">总分</th>
            </tr>
            </thead>
            <tbody>
            {volist name="teacher_data" id="teacher"}
            <tr>
                <td>{$teacher.teacher_no}</td>
                <td>{$teacher.true_name}</td>
                <td>{$teacher.section_name}</td>
                {volist name="teacher.performance_cate" id="cate"}
                <td>{$cate.score}</td>
                {/volist}
                <td>{$teacher.total_score}</td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </div>

</div>

{include file="common/foot"/}
<script>
    layui.use(['table','element','laydate','form'], function() {
        var table = layui.table, form = layui.form, $ = layui.jquery,laydate = layui.laydate;

        table.init('demo', {
            limit: 10 //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
            ,page: true
            ,toolbar:true
            ,defaultToolbar: ['filter', 'print', 'exports']
        });

        // 点击表头隐藏
        $('.layui-table-cell').on('click', function (obj) {
            var classnames = $(this).attr('class');
            var classnamearr  = classnames.split(' ');
            var classname = classnamearr[1];
            $("."+classname).toggle();
        });

        // 点击分类显示
        form.on('select()', function(data){
            $(".laytable-cell-1-title"+data.value).toggle();
        });

        $('#search').on('click', function () {
            // 关键字
            var keyword = $('#keyword').val();
            // 开始时间
            var time = $('#time').val();
            // 结束时间
            var time1 = $('#time1').val();
            // 状态
            var status1 = $('#status1').val();
            //部门
            var section = $('#section').val();

            if(time1!=''&&time==''){
                layer.msg('请选择起始时间！', {icon: 0});
                return;
            }

            if (time>time1){
                layer.msg('起始时间应小于结束时间！', {icon: 0});
                return;
            }

            if (($.trim(keyword) === '') && ($.trim(status1) == 0) && ($.trim(time) === '') && ($.trim(time1) === '') && ($.trim(section) == 0) ) {
                layer.msg('请选择查找条件！', {icon: 0});
                return;
            }

            //表格重载
            tableIn.reload({
                //传递额外参数
                where: {keyword: keyword,start_time:time,end_time:time1,status:status1,section:section}
            });
        });
        //年月选择器
        laydate.render({
            elem: '#time'
            ,format: 'yyyy-MM-dd'
        });
        //年月选择器
        laydate.render({
            elem: '#time1'
            ,format: 'yyyy-MM-dd'
        });
    });
</script>
</body>
</html>